import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '有声书ID',
    align: "center",
    dataIndex: 'audioBookId'
  },
  {
    title: '有声书名',
    align: "center",
    dataIndex: 'audioBookId_dictText'
  },
  {
    title: '推荐类型',
    align: "center",
    dataIndex: 'type',
    customRender:({text}) => {
      let val=''
      if (text===1){
        val='本周强推'
      }
      return  val
    },
  },
  {
    title: '排序号',
    align: "center",
    dataIndex: 'sort'
  },
];
columns.forEach(item=>{
  item.resizable=true
})
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "推荐类型 1=本周强推",
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '有声书ID',
    field: 'audioBookId',
    component: 'InputNumber',
  },
  {
    label: '推荐类型 1=本周强推',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
  },
  {
    label: '排序号',
    field: 'sort',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
